import type { SiteData } from './interface'

import { makeAutoObservable } from 'mobx'
import { DEFAULT_SITE } from './constant'
import * as Storage from '@/storage'

export default class SiteStore {
    public siteData: SiteData = DEFAULT_SITE

    constructor() {
        makeAutoObservable(this)
    }

    /** 更新当前站点信息 */
    updateSiteData(siteData: SiteData) {
        this.siteData = { ...siteData }
        Storage.setLocalStorage('SITE_INFO', this.siteData)
    }
}
